package logic

import (
	"context"

	"xialou_platform/services/agent/rpc/agentClient"
	"xialou_platform/services/agent/rpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type StoreCountLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewStoreCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StoreCountLogic {
	return &StoreCountLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *StoreCountLogic) StoreCount(in *agentClient.StoreCountReq) (*agentClient.StoreCountResp, error) {
	count := l.svcCtx.StoreModel.FindListCount(l.ctx, "", in.Platform, in.Status, in.AgentId, in.SelectFirstPass)
	return &agentClient.StoreCountResp{
		Count: count,
	}, nil
}
